package com.ycy.smartcourseselection.controller;

import com.ycy.smartcourseselection.common.ResData;
import com.ycy.smartcourseselection.dto.courseManage.CoManagesDTO;
import com.ycy.smartcourseselection.dto.scoreManage.ScManagesDTO;
import com.ycy.smartcourseselection.entity.CoManage;
import com.ycy.smartcourseselection.entity.ScoreManage;
import com.ycy.smartcourseselection.service.CoManageService;
import com.ycy.smartcourseselection.service.ScManageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags = "成绩录入管理")
@RestController
@RequestMapping("/scManage")
public class ScManageController {
    @Resource
    private ScManageService scManageService;

    //判断选课状态(是否选课中)
    @GetMapping("/judgeIsBegin")
    @ApiOperation(value="录入 -- 判断录入状态",notes = "没有添加(在添加课程时，后台已添加)")
    public ResData<Boolean> judgeScIsBegin(String courseId) {
        return scManageService.judgeScIsBegin(courseId);
    }

    //修改
    @PostMapping("/save")
    @ApiOperation(value="录入 -- 开始录入(停录)",notes = "没有添加(在添加课程时，后台已添加)")
    public ResData<Boolean> saveScManage(@RequestBody ScoreManage scoreManage) {
        return scManageService.saveScManage(scoreManage);
    }

    //批量修改
    @PostMapping("/saveBatch")
    @ApiOperation(value="录入 -- 批量开始录入(停录)",notes = "没有添加(在添加课程时，后台已添加)")
    public ResData<Boolean> saveBatchScManage(@RequestBody ScManagesDTO scManagesDTO) {
        return scManageService.saveBatchScManage(scManagesDTO);
    }
}
